package com.ykt.model;

import com.jfinal.plugin.activerecord.Page;

import java.util.Map;

public class CameraMarket extends BaseModel<CameraMarket> {
	private static final long serialVersionUID = 1L;

    public static final String market_id = "market_id";
    public static final String camera_id = "camera_id";

    public static final CameraMarket dao = new CameraMarket();


	@Override
    public Page<CameraMarket> paginate(int pageNumber, int rows, Map<String, String> paramMap) {
        String select = "SELECT c.device_serial, c.device_name, c.camera_no, c.camera_name, c.status, a.id, m.name market_name ";
        String exceptSelect = " FROM camera_market a "
        		+ " LEFT JOIN camera c ON a.camera_id = c.id "
        		+ " LEFT JOIN market m ON a.market_id = m.id ";

        paramMap.put("EQ_m.id", paramMap.get("m.id"));

        return this.paginate(select, exceptSelect, pageNumber, rows, paramMap);
    }
}
